import React from 'react';
import './style/index.less';

import {Button} from 'antd';
import Log from "utils";

export default class DomDemo extends React.Component {

  changeDom = () => {
    let domdemoObj = document.getElementById('domdemo');
    domdemoObj.style.backgroundColor = 'green';

    var elem = document.createElement("div");
    elem.id = 'test';
    elem.style = 'color: red';
    elem.innerHTML = '我是新创建的节点';
    domdemoObj.appendChild(elem);

    Log.debug(domdemoObj);

  }

  render() {
    return (
      <div>
        <div id='domdemo'></div>
        <Button onClick={this.changeDom}>刷新dom 添加新节点</Button>
      </div>
    );
  }
}
